var express = require('express');
var router = express.Router();

router.use(function(req, res, next){

    next();
});

var Rest = function(){
    this.restData = {
        errMsg:'',
        errCode:'',
        success:true,
        data:null
    }
    this.setData=function(data){
        this.restData.data = data
    }
}
var rest = new Rest();

var navs = function(){
    return {
        realTimes:[
             {
                name:'实时分析',
                code:'inTime',
                sort:1
            }
        ],
        subjects:[		
            {
                name:'保费达成',
                code:'PFDC',
                sort:1
            },
            {
                name:'组织发展',
                code:'ZZFZ',
                sort:2
            },
            {
                name:'投产比',
                code:'TCB',
                sort:3
            }
        ],
        blocks:[			
            {
                name:'千万登封',
                code:'QWDF',
                sort:1
            },
            {
                name:'跨越五千',
                code:'KYWQ',
                sort:2
            }
        ]
    }
}
var common = function(){
	return [
		{
			name:'首页',
			link:'/index.html'
		},
		{
			name:'菜单',
			link:'./navs.html'
		}
	]
}
router.all('/navs',function(req,res){

	rest.setData(navs());
    res.json(rest.restData)
});
router.all('/common',function(req,res){

	rest.setData(common());
    res.json(rest.restData)
});

module.exports = router;